﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Rappelz.GameServer
{
    public class QuestBase
    {
        public const int MAX_VALUE_NUMBER = 12;
        public const int MAX_OPTIONAL_REWARD = 6;
        public const int MAX_FOREQUEST = 3;
        public const int MAX_KEY_VALUE = 3;
        public const int QUEST_PARAMETER_CHAOS = 99;

        public enum LimitFlags : int
        {
            LimitDeva = 1,
            LimitAsura = 2,
            LimitGaia = 3,
            LimitFighter = 4,
            LimitHunter = 5,
            LimitMagician = 6,
            LimitSummoner = 7,
        }

        public enum QuestTypeFlag : int
        {
            Misc = 0x1,
            KillTotal = 0x2,
            KillIndividual = 0x4,
            FlagCollect = 0x8,
            HuntItem = 0x10,
            LearnSkill = 0x20,
            UpgradeItem = 0x40,
            Contact = 0x80,
            JobLevel = 0x100,
            Paramater = 0x200,
            RandomKillIndividual = 0x400,
            RandomCollect = 0x800,
            HuntItemFromAnyMonster = 0x1000,
            Kill = 0x406,
            All = 0xff,
        }

        public enum QuestType : int
        {
            Misc = 100,
            KillTotal = 101,
            KillIndividual = 102,
            Collect = 103,
            HuntItem = 106,
            HuntItemFromAnyMonsters = 107,
            LearnSkill = 201,
            UpgradeItem = 301,
            Contact = 401,
            JobLevel = 501,
            Parameter = 601,
            EndViaScript = 701,
            RandomKillIndividual = 901,
            RandomCollect = 902,
        }

        public class Reward
        {
            public int nItemCode;
            public int nLevel;
            public int nQuantity;
             
        }

        public int nCode;                                   // 0x0
        public int nQuestTextId;                            // 0x4
        public int nSummaryTextId;                          // 0x8
        public int nStatusTextId;                           // 0xC
        public int nLimitLevel;                             // 0x10
        public int nLimitJobLevel;                          // 0x14
        public int nLimitMaxLevel;                         
        public byte nLimitIndication;                      // 0x18
        public uint LimitFlag;                               // 0x1C
        public int nLimitJob;                               // 0x20
        public int nLimitFavor;                             // 0x24
        public bool bIsRepeatable;                          // 0x28
        public int nInvokeCondition;                        // 0x2C
        public int nInvokeValue;                            // 0x30
        public int nTimeLimit;
        public QuestType nType;                             // 0x34
        public int[] nValue = new int[MAX_VALUE_NUMBER];    // 0x38
        public int nDropGroupId;                            // 0x68
        public int nQuestDifficulty;                        // 0x6C
        public int nFavor;                                  // 0x70
        public long nExp;                                   // 0x78
        public int nJP;                                     // 0x80
        public int nHuntaholicPoint;                        // 0x84
        public long nGold;                                  // 0x88
        public Reward DefaultReward = new Reward();         // 0x90 
        public Reward[] OptionalReward = new Reward[MAX_OPTIONAL_REWARD];   // 0x9C
        public int[] nForeQuest = new int[MAX_FOREQUEST];   // 0xC0
        public bool bForeCheckType;                         // 0xCC
        public int unk1;
        public int unk2;
        public int nIsMagicPointQuest;
        public int unk4;
        public int unk5;
        public int unk6;
        public int unk7;
        public int nEndType;

    }

    public class QuestLink
    {
        public int nNPCId;// Data           :   this+0x0, Member, Type: int, 
        public int code;// Data           :   this+0x4, Member, Type: int, 
        public bool bLF_Start;// Data           :   this+0x8, Member, Type: bool, 
        public bool bLF_Progress;// Data           :   this+0x9, Member, Type: bool, 
        public bool bLF_End;// Data           :   this+0xA, Member, Type: bool, 
        public int nStartTextId;// Data           :   this+0xC, Member, Type: int, 
        public int nInProgressTextId;// Data           :   this+0x10, Member, Type: int, 
        public int nEndTextId;// Data           :   this+0x14, Member, Type: int, 
    }

}
